﻿@using si.caha.Model;
@using si.caha.Repository;

@{
    Layout = "/tpl/_layout.cshtml";
    PageData["PageTitle"] = "Edit category";
    var dataContext = new DataContext();

    Category category = new Category();
    var categoryRepository = new CategoryRepository(dataContext);
    var errors = new Dictionary<string, string>();

    if (UrlData[0].Length > 0)
    {
        var id = UrlData[0].IsInt() ? UrlData[0].AsInt() : 0;
        category = categoryRepository.Get(id);
    }
}
@RenderPage("_form.cshtml", new {errors = @errors, category = @category})